package com.xx.pmis.services.implementations;

import java.util.List;

import com.xx.pmis.model.Role;
import com.xx.pmis.persistence.dao.RoleDAO;
import com.xx.pmis.services.RoleService;

public class RoleServiceImpl implements RoleService {
	RoleDAO roleDAO = null;

	public RoleServiceImpl(RoleDAO roleDAO) {
		super();
		this.roleDAO = roleDAO;
	}

	public void saveOrUpdateRole(Role role) throws Exception {
		roleDAO.saveOrUpdate(role);
	}

	public void saveRole(Role role) throws Exception {
		roleDAO.save(role);
	}

	public void deleteRole(Role role) throws Exception {
		roleDAO.delete(role);
	}

	public Role getRoleByRoleID(String roleID) throws Exception {
		Role Role = roleDAO.getRoleByRoleID(roleID);
		return Role;
	}

	public List<Role> getAllRole() throws Exception {
		List<Role> roles = roleDAO.getAllRole();
		return roles;
	}

	public Role getRoleByRoleCode(String roleCode) throws Exception {
		Role Role = roleDAO.getRoleByRoleCode(roleCode);
		return Role;
	}

}
